package gins

import (
	"github.com/gin-gonic/gin"
)

type HandlerFunc func(ctx *gin.Context) interface{}

type RouterRegister interface {
	Register(engine IRoutes)
}

type RouterInfo struct {
	RelativePath string
	AbsolutePath string
	Handlers     []HandlerFunc
}

type GinRoutePrintRegister func(g IEngine)

type IRoutes interface {
	Group(relativePath string, handlers ...gin.HandlerFunc) IRoutes
	Use(...gin.HandlerFunc) IRoutes

	Handle(string, string, ...HandlerFunc) IRoutes
	Any(string, ...HandlerFunc) IRoutes
	GET(string, ...HandlerFunc) IRoutes
	POST(string, ...HandlerFunc) IRoutes
	DELETE(string, ...HandlerFunc) IRoutes
	PATCH(string, ...HandlerFunc) IRoutes
	PUT(string, ...HandlerFunc) IRoutes
	OPTIONS(string, ...HandlerFunc) IRoutes
	HEAD(string, ...HandlerFunc) IRoutes
	Match([]string, string, ...HandlerFunc) IRoutes
}

type IEngine interface {
	IRoutes

	GetRouteInfo(httpMethod, absolutePath string) (RouterInfo, bool)

	ResponseHandler(ctx *gin.Context, v interface{})
	RequestHandler(handlerFunc HandlerFunc) gin.HandlerFunc
}
